/**
 * Created by daniel on 14/03/2017.
 * https://stackoverflow.com/questions/4606847/why-does-ie-nuke-window-abc-variables
 */
var embbedWfPage;
var defaultComponentAttr;
var fieldTypeOptions;
var approvalBtns;
var approvalTypeData;
var processStatus;
var processStatusConstant;
var bsTablePageList;
var flowDetailConnStyle;
var finishBg;
var unFinishBg;
var currentBg;
var refuseBg;
var detailView;

window.embbedWfPage = true;
//配置审批页面是否显示指定的详情字段
window.detailView = false;
window.defaultComponentAttr = {
    "startevent-none": {
        "name": "start"
    },
    "endevent-none": {
        "name": "end"
    },
    "gateway-exclusive": {
        "name": "decision"
    },
    "gateway-fork": {
        "name": "fork"
    },
    "gateway-join": {
        "name": "join"
    },
    "endevent-cancel": {
        "name": "cancal"
    },
    "connection": {
        "name": "connection"
    },
    "task": {
        "name": "task"
    }
};
window.fieldTypeOptions = "{'k-field-text': 'text'}, {'k-field-select': 'select'}, {'k-field-mselect': 'mselect'}, {'k-field-date': 'date'}" +
    ", {'k-field-time': 'time'}, {'k-field-textarea': 'textarea'}, {'k-field-tree': 'tree'}, {'k-field-mselecttree': 'mselecttree'},{'k-field-mInput': 'mInput'}";

//按钮显示
window.approvalBtns = [
    {
        id: "0",
        name: "提交"
    },
    {
        id: "1",
        name: "拒绝"
    },
    {
        id: "2",
        name: "驳回"
    },
    {
        id: "3",
        name: "通过"
    }
];

//审核类型。 审批和转审批
window.approvalTypeData = "{'0': '普通'}, {'1': '转审批'}";

window.processStatus = {
    "1": "运行中",
    "2": "驳回",
    "3": "拒绝",
    "4": "驳回到申请节点",
    "5": "通过",
    "6": "重新提交",
    "9": "已完成"
};

window.processStatusConstant = {
    running: 1,
    reject: 2,
    refuse: 3,
    rejectToApply: 4,
    pass: 5,
    reApply: 6,
    finish: 9
};


window.bsTablePageList = [10, 20, 50, 100];

/****流程颜色开始**/

//经过路线颜色
window.flowDetailConnStyle = {
    strokeStyle: "red",
    lineWidth: 3
};
//已审批
window.finishBg = '#499ACF';
//未审批
window.unFinishBg = '#D6D8D9';
//当前任务
window.currentBg = '#00FF00';
//拒绝
window.refuseBg = '#d9534f';

/****流程颜色结束**/

// 流程服务显示url，设置iframe高度
window.setIframeHeight = function (id) {
  var ifrm = document.getElementById(id);
  var doc = ifrm.contentDocument ? ifrm.contentDocument :
    ifrm.contentWindow.document;
  ifrm.style.visibility = 'hidden';
  ifrm.style.height = "10px";
  var customHeight = $(doc).find('body').attr('data-custom-height');
  if (customHeight) {
    customHeight = customHeight.indexOf('px') ? customHeight.substring(0, customHeight.length - 2) : customHeight;
  }
  ifrm.style.height = customHeight || getDocHeight(doc) + 4 + "px";
  ifrm.style.visibility = 'visible';
}
